package com.oracle.application.controller;


import com.oracle.application.empty.Member;
import com.oracle.application.empty.vo.R;
import com.oracle.application.service.impl.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 莉丝妲黛
 */
@RestController
@RequestMapping("/member")
public class MemberController {

    @Autowired
    private MemberService memberService;

    @GetMapping("/list")
    public List<Member> list(){
        return this.memberService.list();
    }

    @PostMapping("delById")
    public R deleteById(@RequestBody Integer id){
        boolean b = this.memberService.removeById(id);
        //System.out.println(1/0);
        if (b) {
            return new R(200, "success", null);
        }
        return new R(201, "fail", null);
    }
}
